package com.wenwei.paper.net;


import com.wenwei.paper.bean.AddGoodsListBean;
import com.wenwei.paper.bean.ApiResultBean;
import com.wenwei.paper.bean.DeviceListBean;
import com.wenwei.paper.bean.MessageBean;
import com.wenwei.paper.bean.OpenDeviceBean;
import com.wenwei.paper.bean.PageBean;
import com.wenwei.paper.bean.ReplenishmentDetailBean;
import com.wenwei.paper.bean.ReplenishmentEndListBean;
import com.wenwei.paper.bean.ReplenishmentListBean;
import com.wenwei.paper.bean.Test;
import com.wenwei.paper.bean.UserLoginBean;
import com.wenwei.paper.bean.VersionBean;

import java.util.ArrayList;

import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Query;
import rx.Observable;

/**
 * Created by Bo on 2016/7/5.
 *
 * API请求接口
 *
 * 封装所有的请求API接口
 */
public interface ApiInterface {


    //短信验证码 ( type  1:注册，2:忘记密码)
    @GET("api/smscode")
    Observable<ApiResultBean<ArrayList>> getSmsCode(@Query("phone") String phone,
                                                  @Query("sms_code_type") int type);

    //注册
    @POST("api/enter")
    Observable<ApiResultBean<ArrayList>> userRegister(@Body RequestBody body);

    //登录jb.put("registration_id", JPushInterface.getRegistrationID(mContext));
    @GET("api/enter")
    Observable<ApiResultBean<UserLoginBean>> userLogin(@Query("phone") String phone,
                                                       @Query("password") String ps,
                                                       @Query("registration_id") String id);

    //忘记密码
    @PUT("api/enter")
    Observable<ApiResultBean<UserLoginBean>> userUpdate(@Body RequestBody body);

    //消息通知
    @GET("api/doUnread")
    Observable<ApiResultBean<MessageBean>> messageNotify();

    //补货通知
    @GET("api/doList")
    Observable<ApiResultBean<PageBean<ArrayList<ReplenishmentListBean>>>> getReplenishmentList(@Query("page") int page);

    //补货详情
    @GET("api/doDetail")
    Observable<ApiResultBean<ReplenishmentDetailBean>> getReplenishmentDetails(@Query("chargelistId") int id);


    //已补货列表（我的清单）
    @GET("api/doneList")
    Observable<ApiResultBean<PageBean<ArrayList<ReplenishmentEndListBean>>>> getReplenishmentEnd(@Query("page") int page);

    //配货商品列表（货品补充）
    @GET("api/goods")
    Observable<ApiResultBean<ArrayList<AddGoodsListBean>>> getAddGoodsList(@Query("deviceId") String deviceId);

    //配货操作（进行补货）
    @FormUrlEncoded
    @POST("/appAPI/index/setstock")
    Observable<Test> addGoods(@Field("devicelistId") int rcmCode,
                              @Field("num") int customerId);

    //设备列表
    @GET("api/deviceList")
    Observable<ApiResultBean<PageBean<ArrayList<DeviceListBean>>>> getDeviceList(@Query("page") int page);

    //版本号
    @GET("api/topVersion")
    Observable<ApiResultBean<VersionBean>> getVersion(@Query("version_type") int type,
                                                      @Query("version_code") int code);

    //www.xcentiot.com/appAPI/index/opendoor?deviceid=zq100n224417144
    @GET("/appAPI/index/opendoor")
    Observable<ApiResultBean<OpenDeviceBean>> openDevice(@Query("deviceid") String id);
    //www.xcentiot.com/appAPI/index/hasopendoor?deviceid=zq100n224417144&log_id=44accc67-78a4-c888-55d5-ecefcaafa343
    @GET("/appAPI/index/hasopendoor")
    Observable<ApiResultBean<OpenDeviceBean>> hasOpenDevice(@Query("deviceid") String id,
                                                            @Query("log_id") String log);
}







